package cn.xhy.module.purchase.dal.mysql.documentserial;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.xhy.module.purchase.dal.dataobject.documentserial.DocumentSerialDO;
import org.apache.ibatis.annotations.Mapper;
import cn.xhy.module.purchase.controller.admin.documentserial.vo.*;

/**
 * 单据序号 Mapper
 *
 * @author xhy
 */
@Mapper
public interface DocumentSerialMapper extends BaseMapperX<DocumentSerialDO> {

    default PageResult<DocumentSerialDO> selectPage(DocumentSerialPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DocumentSerialDO>()
                .eqIfPresent(DocumentSerialDO::getDocumentNumber, reqVO.getDocumentNumber())
                .eqIfPresent(DocumentSerialDO::getInitial, reqVO.getInitial())
                .betweenIfPresent(DocumentSerialDO::getDjDate, reqVO.getDjDate())
                .eqIfPresent(DocumentSerialDO::getSerialNumber, reqVO.getSerialNumber())
                .betweenIfPresent(DocumentSerialDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DocumentSerialDO::getId));
    }

}